package it.koutifaris.travianmap.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import junit.framework.Assert;
import android.test.AndroidTestCase;

public class DayTruncUtilsTest extends AndroidTestCase {

	public void testTrunc() throws ParseException {
		SimpleDateFormat hoursSdf = new SimpleDateFormat("dd/MM/yyyy hh:mm", Locale.getDefault());
		SimpleDateFormat daySdf = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault());

		Date dateWithHours = hoursSdf.parse("23/08/1979 17:30");
		Date day = daySdf.parse("23/08/1979");

		Date truncedDate = DayTruncUtils.truncDateToDay(dateWithHours);

		Assert.assertEquals(day, truncedDate);
	}
}
